{% extends 'ApiCloud/Base/layout.common.html.twig' %}

{% block main %}
    {% include "ApiCloud/Base/inc.head.light.html.twig" with {title:"固定资产",back:1} %}
    <mu-tabs :value.sync="tab" color="amber600" indicator-color="amber600" inverse center>
        <mu-tab>资产管理</mu-tab>
        <mu-tab>录入/编辑资产</mu-tab>
    </mu-tabs>
    <div class="pad10" v-if="tab == 1">
        <mu-form ref="form" :model="en"  label-position="top" label-width="100">

            <div class="fs10 padl5 padr5">
                <mu-form-item label="分类" :rules="[rules.notNull]" prop="category">
                    <mu-select v-model="en.category" full-width>
                        <mu-option v-for="item in cat"
                                   :key="item.id" :label="item.name" :value="item.id"></mu-option>
                    </mu-select>
                </mu-form-item>
                <mu-form-item label="名称" :rules="[rules.notNull]" prop="category">
                    <mu-text-field v-model="en.name"></mu-text-field>
                </mu-form-item>
                <mu-form-item label="购买日期" type="date" :rules="[rules.notNull]" prop="buyDate">
                    <mu-date-input v-model="en.buyDate"format="YYYY-MM-DD" label-float full-width no-display></mu-date-input>
                </mu-form-item>
                <mu-form-item label="价格" :rules="[rules.notNull,rules.isNum]" prop="price">
                    <mu-text-field v-model="en.price"></mu-text-field>
                </mu-form-item>
                <mu-form-item label="经办" :rules="[rules.notNull]" prop="userBuy">
                    <mu-text-field v-model="en.userBuy"></mu-text-field>
                </mu-form-item>
                <mu-form-item label="审核" :rules="[rules.notNull]" prop="userCheck">
                    <mu-text-field v-model="en.userCheck"></mu-text-field>
                </mu-form-item>
                <mu-form-item label="保管" :rules="[rules.notNull]" prop="userKeep">
                    <mu-text-field v-model="en.userKeep"></mu-text-field>
                </mu-form-item>
                <mu-form-item label="状态" :rules="[rules.notNull]" prop="status">
                    <mu-text-field v-model="en.status"></mu-text-field>
                </mu-form-item>

                <div class="fs8 c11 pad5 mart10">
                    <mu-button large full-width round color="primary" @click="submit()">保存提交</mu-button>
                </div>
            </div>
        </mu-form>
    </div>
    <div class="pad10" v-if="tab == 0">
        <div class="fs8 c11">

            <mu-ripple class="pos-r bcf padb5 round5 mart5  bdc11 c11" v-for="item,index in list"  @click="select(index)">
                <div class="flrc pad5 fs12">
                    <mu-icon value="devices"></mu-icon>
                    <div class="padl5">资产名称：</div>
                    <div class="flex1">[[item.Fixed_name]]</div>
                    <div class="c12">
                        <mu-icon value="edit" size="14"></mu-icon>
                    </div>
                </div>
                <div class="flrc pad5 c12">
                    <div class="">经办：</div>
                    <div class="flex1">[[item.Fixed_user_Buy]]</div>
                    <div class="">审核：</div>
                    <div class="flex1">[[item.Fixed_user_Check]]</div>
                    <div class="">保管：</div>
                    <div class="flex1">[[item.Fixed_user_Keep]]</div>
                </div>
                <div class="flrc pad5">
                    <div>购买日期:</div>
                    <div>[[item.Fixed_buy_Date]]</div>

                </div>
                <div class="bdtso pad5 flrc">
                    <div class="">状态：</div>
                    <div class="flex1">[[item.Fixed_status]]</div>
                </div>
            </mu-ripple>
        </div>
    </div>

    <mu-bottom-sheet :open.sync="open">
        <mu-list @item-click="">
            <mu-sub-header>请选择操作</mu-sub-header>
            <mu-list-item button @click="edit(index)">
                <mu-list-item-action>
                    <mu-icon value="edit" color="green"></mu-icon>
                </mu-list-item-action>
                <mu-list-item-title>编辑</mu-list-item-title>
            </mu-list-item>
            <mu-list-item button @click="del(index)">
                <mu-list-item-action>
                    <mu-icon value="delete_forever" color="blue"></mu-icon>
                </mu-list-item-action>
                <mu-list-item-title>删除</mu-list-item-title>
            </mu-list-item>
            <mu-list-item button @click="cancel">
                <mu-list-item-action>
                    <mu-icon value="power_settings_new" color="orange"></mu-icon>
                </mu-list-item-action>
                <mu-list-item-title>取消</mu-list-item-title>
            </mu-list-item>
        </mu-list>
    </mu-bottom-sheet>
{% endblock %}
